// ========================================== // app/api/tbe/sessions/[sessionId]/vendor-remarks/route.ts // ========================================== import { NextRequest, NextResponse } from "next/server" import { getServerSession } from "next-auth" import { authOptions } from "@/app/api/auth/[...nextauth]/route" import { updateVendorRemarks } from "@/lib/tbe-last/vendor-tbe-service" interface Props { params: { sessionId: string } } // PUT: 벤더 의견 업데이트 export async function PUT( request: NextRequest, { params }: Props ) { try { const session = await getServerSession(authOptions) if (!session?.user?.companyId) { return NextResponse.json( { error: "Unauthorized" }, { status: 401 } ) } const vendorId = typeof session.user.companyId === 'string' ? parseInt(session.user.companyId) : session.user.companyId const sessionId = parseInt(params.sessionId) const body = await request.json() const { remarks } = body if (!remarks) { return NextResponse.json( { error: "Remarks are required" }, { status: 400 } ) } const updated = await updateVendorRemarks(sessionId, vendorId, remarks) return NextResponse.json(updated) } catch (error) { console.error("Update remarks error:", error) return NextResponse.json( { error: "Failed to update remarks" }, { status: 500 } ) } }